[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
char Character Data Type
The char type declares an object to be of "plain" integral character
type. A char object is large enough to store any character in the
host character set. Whether the character is signed or unsigned is
implementation-defined.
Notes: In Turbo C++, the character set is ASCII and the size
of a char object is eight bits. A char may contain any
8-bit representation, not just the ASCII characters; note
that non-ASCII characters will be stored as negative
numbers, since "plain" chars are signed by default. That
is, char is equivalent to signed char and its range of
values is -128 to 127, inclusive.
One of the keywords signed and unsigned may be used as a
prefix to char to identify the character as being signed
or unsigned, respectively. An unsigned char can have a
value in the range 0 to 255.
By definition, sizeof(char) is one.
When a char is used as a function argument, it is first
promoted to an int.
-------------------------------- Examples --------------------------------
char value = 6;
char action_code = 'A';
char bit_pattern = '\xAB';
char birth_date[7];
char *pointer_to_char;
char function();
value = (char) 12345;
See Also:
Types
signed
unsigned
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson